<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LINE 1 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-1"></span><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span>
</span><span id="line-2"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- Module      :  System.Win32.Registry</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- Copyright   :  (c) Alastair Reid, 1997-2003</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- License     :  BSD-style (see the file libraries/base/LICENSE)</span><span>
</span><span id="line-7"></span><span class="hs-comment">--</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Maintainer  :  Esa Ilari Vuokko &lt;ei@vuokko.info&gt;</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Stability   :  provisional</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- A collection of FFI declarations for accessing the Win32 registry.</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Win32.Registry</span><span>
</span><span id="line-17"></span><span>    </span><span class="hs-special">(</span><span>
</span><span id="line-18"></span><span>      </span><span class="hs-comment">-- * HKEY</span><span>
</span><span id="line-19"></span><span>      </span><span class="hs-identifier">HKEY</span><span>
</span><span id="line-20"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hKEY_CLASSES_ROOT</span><span>
</span><span id="line-21"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hKEY_CURRENT_CONFIG</span><span>
</span><span id="line-22"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hKEY_CURRENT_USER</span><span>
</span><span id="line-23"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hKEY_LOCAL_MACHINE</span><span>
</span><span id="line-24"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hKEY_USERS</span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span>      </span><span class="hs-comment">-- * Creation options</span><span>
</span><span id="line-27"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">RegCreateOptions</span><span>
</span><span id="line-28"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_OPTION_NON_VOLATILE</span><span>
</span><span id="line-29"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_OPTION_VOLATILE</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span>      </span><span class="hs-comment">-- * REGSAM</span><span>
</span><span id="line-32"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">REGSAM</span><span>
</span><span id="line-33"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">kEY_ALL_ACCESS</span><span>
</span><span id="line-34"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">kEY_CREATE_LINK</span><span>
</span><span id="line-35"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">kEY_CREATE_SUB_KEY</span><span>
</span><span id="line-36"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">kEY_ENUMERATE_SUB_KEYS</span><span>
</span><span id="line-37"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">kEY_EXECUTE</span><span>
</span><span id="line-38"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">kEY_NOTIFY</span><span>
</span><span id="line-39"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">kEY_QUERY_VALUE</span><span>
</span><span id="line-40"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">kEY_READ</span><span>
</span><span id="line-41"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">kEY_SET_VALUE</span><span>
</span><span id="line-42"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">kEY_WRITE</span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span>      </span><span class="hs-comment">-- * Registry operations</span><span>
</span><span id="line-45"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regCloseKey</span><span>
</span><span id="line-46"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regConnectRegistry</span><span>
</span><span id="line-47"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regCreateKey</span><span>
</span><span id="line-48"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regCreateKeyEx</span><span>
</span><span id="line-49"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regDeleteKey</span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regDeleteValue</span><span>
</span><span id="line-51"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regEnumKeys</span><span>
</span><span id="line-52"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regEnumKeyVals</span><span>
</span><span id="line-53"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regEnumKey</span><span>
</span><span id="line-54"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regEnumValue</span><span>
</span><span id="line-55"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regFlushKey</span><span>
</span><span id="line-56"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regLoadKey</span><span>
</span><span id="line-57"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regUnLoadKey</span><span>
</span><span id="line-58"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regNotifyChangeKeyValue</span><span>
</span><span id="line-59"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">RegNotifyOptions</span><span>
</span><span id="line-60"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_NOTIFY_CHANGE_NAME</span><span>
</span><span id="line-61"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_NOTIFY_CHANGE_ATTRIBUTES</span><span>
</span><span id="line-62"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_NOTIFY_CHANGE_LAST_SET</span><span>
</span><span id="line-63"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_NOTIFY_CHANGE_SECURITY</span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regOpenKey</span><span>
</span><span id="line-66"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regOpenKeyEx</span><span>
</span><span id="line-67"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regQueryInfoKey</span><span>
</span><span id="line-68"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">RegInfoKey</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-69"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regQueryValue</span><span>
</span><span id="line-70"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regQueryValueKey</span><span>
</span><span id="line-71"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regQueryDefaultValue</span><span>
</span><span id="line-72"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regQueryValueEx</span><span>
</span><span id="line-73"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regReplaceKey</span><span>
</span><span id="line-74"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">RegRestoreFlags</span><span>
</span><span id="line-75"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_WHOLE_HIVE_VOLATILE</span><span>
</span><span id="line-76"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_REFRESH_HIVE</span><span>
</span><span id="line-77"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_NO_LAZY_FLUSH</span><span>
</span><span id="line-78"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regRestoreKey</span><span>
</span><span id="line-79"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regSaveKey</span><span>
</span><span id="line-80"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regGetValue</span><span>
</span><span id="line-81"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-82"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_RT_ANY</span><span>
</span><span id="line-83"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_RT_DWORD</span><span>
</span><span id="line-84"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_RT_QWORD</span><span>
</span><span id="line-85"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_RT_REG_BINARY</span><span>
</span><span id="line-86"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_RT_REG_DWORD</span><span>
</span><span id="line-87"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_RT_REG_EXPAND_SZ</span><span>
</span><span id="line-88"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_RT_REG_MULTI_SZ</span><span>
</span><span id="line-89"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_RT_REG_NONE</span><span>
</span><span id="line-90"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_RT_REG_QWORD</span><span>
</span><span id="line-91"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_RT_REG_SZ</span><span>
</span><span id="line-92"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_NOEXPAND</span><span>
</span><span id="line-93"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_ZEROONFAILURE</span><span>
</span><span id="line-94"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_SUBKEY_WOW6464KEY</span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rRF_SUBKEY_WOW6432KEY</span><span>
</span><span id="line-96"></span><span>
</span><span id="line-97"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regSetValue</span><span>
</span><span id="line-98"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regSetValueEx</span><span>
</span><span id="line-99"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-100"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_BINARY</span><span>
</span><span id="line-101"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_DWORD</span><span>
</span><span id="line-102"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_DWORD_LITTLE_ENDIAN</span><span>
</span><span id="line-103"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_DWORD_BIG_ENDIAN</span><span>
</span><span id="line-104"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_EXPAND_SZ</span><span>
</span><span id="line-105"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_LINK</span><span>
</span><span id="line-106"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_MULTI_SZ</span><span>
</span><span id="line-107"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_NONE</span><span>
</span><span id="line-108"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_RESOURCE_LIST</span><span>
</span><span id="line-109"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEG_SZ</span><span>
</span><span id="line-110"></span><span>
</span><span id="line-111"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">regSetStringValue</span><span>  </span><span class="hs-comment">-- :: HKEY -&gt; String -&gt; String -&gt; IO ()</span><span>
</span><span id="line-112"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-113"></span><span>
</span><span id="line-114"></span><span class="hs-comment">{-
 Registry API omissions:

   RegQueryMultipleValues()
   RegEnumKeyEx()

-}</span><span>
</span><span id="line-121"></span><span>
</span><span id="line-122"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Word</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Word32</span><span class="hs-special">)</span><span>
</span><span id="line-123"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.ForeignPtr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">withForeignPtr</span><span class="hs-special">)</span><span>
</span><span id="line-124"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.Marshal.Alloc</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">alloca</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">allocaBytes</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">free</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mallocBytes</span><span class="hs-special">)</span><span>
</span><span id="line-125"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.Marshal.Array</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">allocaArray0</span><span class="hs-special">)</span><span>
</span><span id="line-126"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.Marshal.Utils</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybeWith</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">with</span><span class="hs-special">)</span><span>
</span><span id="line-127"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.Ptr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Ptr</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">castPtr</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">nullPtr</span><span class="hs-special">)</span><span>
</span><span id="line-128"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.Storable</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">peek</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">peekByteOff</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">peekElemOff</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sizeOf</span><span class="hs-special">)</span><span>
</span><span id="line-129"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.IO.Unsafe</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unsafePerformIO</span><span class="hs-special">)</span><span>
</span><span id="line-130"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.File</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span class="hs-special">)</span><span>
</span><span id="line-131"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Time</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">FILETIME</span><span class="hs-special">)</span><span>
</span><span id="line-132"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Types</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">DWORD</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ErrCode</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">HKEY</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LPCTSTR</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">PKEY</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">withTString</span><span class="hs-special">)</span><span>
</span><span id="line-133"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Types</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">HANDLE</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LONG</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LPBYTE</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">newForeignHANDLE</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">peekTString</span><span class="hs-special">)</span><span>
</span><span id="line-134"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Types</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">LPTSTR</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">TCHAR</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LPDWORD</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LPVOID</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">failUnlessSuccess</span><span class="hs-special">)</span><span>
</span><span id="line-135"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Types</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">castUINTPtrToPtr</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">failUnlessSuccessOr</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">maybePtr</span><span class="hs-special">)</span><span class="hs-cpp">

#include &quot;windows_cconv.h&quot;
</span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span>
</span><span id="line-141"></span><span>
</span><span id="line-142"></span><span class="hs-identifier">hKEY_CLASSES_ROOT</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span>
</span><span id="line-143"></span><span class="hs-identifier">hKEY_CLASSES_ROOT</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unsafePerformIO</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">newForeignHANDLE</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span class="hs-special">)</span><span> </span><span class="hs-number">18446744071562067968</span><span>
</span><span id="line-144"></span><span class="hs-identifier">hKEY_CURRENT_CONFIG</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span>
</span><span id="line-145"></span><span class="hs-identifier">hKEY_CURRENT_CONFIG</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unsafePerformIO</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">newForeignHANDLE</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span class="hs-special">)</span><span> </span><span class="hs-number">18446744071562067973</span><span>
</span><span id="line-146"></span><span class="hs-identifier">hKEY_CURRENT_USER</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span>
</span><span id="line-147"></span><span class="hs-identifier">hKEY_CURRENT_USER</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unsafePerformIO</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">newForeignHANDLE</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span class="hs-special">)</span><span> </span><span class="hs-number">18446744071562067969</span><span>
</span><span id="line-148"></span><span class="hs-identifier">hKEY_LOCAL_MACHINE</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span>
</span><span id="line-149"></span><span class="hs-identifier">hKEY_LOCAL_MACHINE</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unsafePerformIO</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">newForeignHANDLE</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span class="hs-special">)</span><span> </span><span class="hs-number">18446744071562067970</span><span>
</span><span id="line-150"></span><span class="hs-identifier">hKEY_USERS</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span>
</span><span id="line-151"></span><span class="hs-identifier">hKEY_USERS</span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unsafePerformIO</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">newForeignHANDLE</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span class="hs-special">)</span><span> </span><span class="hs-number">18446744071562067971</span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span class="hs-pragma">{-# LINE 149 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-149"></span><span class="hs-comment">-- , PKEYERFORMANCE_DATA  NT only</span><span>
</span><span id="line-150"></span><span class="hs-comment">-- , HKEY_DYN_DATA     95/98 only</span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span class="hs-identifier">regCloseKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-153"></span><span class="hs-identifier">regCloseKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-154"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-155"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegCloseKey&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_RegCloseKey</span><span> </span><span class="hs-identifier">p_key</span><span>
</span><span id="line-156"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegCloseKey&quot;</span><span>
</span><span id="line-157"></span><span>  </span><span class="hs-identifier">c_RegCloseKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-158"></span><span>
</span><span id="line-159"></span><span class="hs-comment">-- Connects to a predefined registry handle on another computer.</span><span>
</span><span id="line-160"></span><span>
</span><span id="line-161"></span><span class="hs-identifier">regConnectRegistry</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HKEY</span><span>
</span><span id="line-162"></span><span class="hs-identifier">regConnectRegistry</span><span> </span><span class="hs-identifier">mb_machine</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-163"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-164"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">mb_machine</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_machine</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-165"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_out_key</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-166"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegConnectRegistry&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-167"></span><span>    </span><span class="hs-identifier">c_RegConnectRegistry</span><span> </span><span class="hs-identifier">c_machine</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">p_out_key</span><span>
</span><span id="line-168"></span><span>  </span><span class="hs-identifier">p_new_key</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_out_key</span><span>
</span><span id="line-169"></span><span>  </span><span class="hs-identifier">newForeignHANDLE</span><span> </span><span class="hs-identifier">p_new_key</span><span>
</span><span id="line-170"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegConnectRegistryW&quot;</span><span>
</span><span id="line-171"></span><span>  </span><span class="hs-identifier">c_RegConnectRegistry</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-172"></span><span>
</span><span id="line-173"></span><span class="hs-identifier">regCreateKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HKEY</span><span>
</span><span id="line-174"></span><span class="hs-identifier">regCreateKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-175"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-176"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-177"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_out_key</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-178"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegCreateKey&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-179"></span><span>    </span><span class="hs-identifier">c_RegCreateKey</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">p_out_key</span><span>
</span><span id="line-180"></span><span>  </span><span class="hs-identifier">p_new_key</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_out_key</span><span>
</span><span id="line-181"></span><span>  </span><span class="hs-identifier">newForeignHANDLE</span><span> </span><span class="hs-identifier">p_new_key</span><span>
</span><span id="line-182"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegCreateKeyW&quot;</span><span>
</span><span id="line-183"></span><span>  </span><span class="hs-identifier">c_RegCreateKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-184"></span><span>
</span><span id="line-185"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">RegCreateOptions</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span class="hs-identifier">rEG_OPTION_NON_VOLATILE</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegCreateOptions</span><span>
</span><span id="line-188"></span><span class="hs-identifier">rEG_OPTION_NON_VOLATILE</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-189"></span><span class="hs-identifier">rEG_OPTION_VOLATILE</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegCreateOptions</span><span>
</span><span id="line-190"></span><span class="hs-identifier">rEG_OPTION_VOLATILE</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-191"></span><span>
</span><span id="line-192"></span><span class="hs-pragma">{-# LINE 191 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-191"></span><span>
</span><span id="line-192"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">REGSAM</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Word32</span><span>
</span><span id="line-193"></span><span class="hs-pragma">{-# LINE 193 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span class="hs-identifier">kEY_ALL_ACCESS</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">REGSAM</span><span>
</span><span id="line-195"></span><span class="hs-identifier">kEY_ALL_ACCESS</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">983103</span><span>
</span><span id="line-196"></span><span class="hs-identifier">kEY_CREATE_LINK</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">REGSAM</span><span>
</span><span id="line-197"></span><span class="hs-identifier">kEY_CREATE_LINK</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32</span><span>
</span><span id="line-198"></span><span class="hs-identifier">kEY_CREATE_SUB_KEY</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">REGSAM</span><span>
</span><span id="line-199"></span><span class="hs-identifier">kEY_CREATE_SUB_KEY</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-200"></span><span class="hs-identifier">kEY_ENUMERATE_SUB_KEYS</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">REGSAM</span><span>
</span><span id="line-201"></span><span class="hs-identifier">kEY_ENUMERATE_SUB_KEYS</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-202"></span><span class="hs-identifier">kEY_EXECUTE</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">REGSAM</span><span>
</span><span id="line-203"></span><span class="hs-identifier">kEY_EXECUTE</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">131097</span><span>
</span><span id="line-204"></span><span class="hs-identifier">kEY_NOTIFY</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">REGSAM</span><span>
</span><span id="line-205"></span><span class="hs-identifier">kEY_NOTIFY</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-206"></span><span class="hs-identifier">kEY_QUERY_VALUE</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">REGSAM</span><span>
</span><span id="line-207"></span><span class="hs-identifier">kEY_QUERY_VALUE</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-208"></span><span class="hs-identifier">kEY_READ</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">REGSAM</span><span>
</span><span id="line-209"></span><span class="hs-identifier">kEY_READ</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">131097</span><span>
</span><span id="line-210"></span><span class="hs-identifier">kEY_SET_VALUE</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">REGSAM</span><span>
</span><span id="line-211"></span><span class="hs-identifier">kEY_SET_VALUE</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-212"></span><span class="hs-identifier">kEY_WRITE</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">REGSAM</span><span>
</span><span id="line-213"></span><span class="hs-identifier">kEY_WRITE</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">131078</span><span>
</span><span id="line-214"></span><span>
</span><span id="line-215"></span><span class="hs-pragma">{-# LINE 206 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span class="hs-identifier">regCreateKeyEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">RegCreateOptions</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">REGSAM</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">HKEY</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">Bool</span><span class="hs-special">)</span><span>
</span><span id="line-208"></span><span class="hs-identifier">regCreateKeyEx</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-identifier">cls</span><span> </span><span class="hs-identifier">opts</span><span> </span><span class="hs-identifier">sam</span><span> </span><span class="hs-identifier">mb_attr</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-209"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-210"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-211"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">cls</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_cls</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-212"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_res</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-213"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_disp</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-214"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegCreateKeyEx&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-215"></span><span>    </span><span class="hs-identifier">c_RegCreateKeyEx</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">c_cls</span><span> </span><span class="hs-identifier">opts</span><span> </span><span class="hs-identifier">sam</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_attr</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p_res</span><span> </span><span class="hs-identifier">p_disp</span><span>
</span><span id="line-216"></span><span>  </span><span class="hs-identifier">p_out_key</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_res</span><span>
</span><span id="line-217"></span><span>  </span><span class="hs-identifier">out_key</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">newForeignHANDLE</span><span> </span><span class="hs-identifier">p_out_key</span><span>
</span><span id="line-218"></span><span>  </span><span class="hs-identifier">disp</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_disp</span><span>
</span><span id="line-219"></span><span>  </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">out_key</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">disp</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span class="hs-pragma">{-# LINE 220 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-220"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegCreateKeyExW&quot;</span><span>
</span><span id="line-221"></span><span>  </span><span class="hs-identifier">c_RegCreateKeyEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">RegCreateOptions</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">REGSAM</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-222"></span><span>
</span><span id="line-223"></span><span class="hs-identifier">regDeleteKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-224"></span><span class="hs-identifier">regDeleteKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-225"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-226"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-227"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegDeleteKey&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_RegDeleteKey</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span>
</span><span id="line-228"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegDeleteKeyW&quot;</span><span>
</span><span id="line-229"></span><span>  </span><span class="hs-identifier">c_RegDeleteKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-230"></span><span>
</span><span id="line-231"></span><span class="hs-identifier">regDeleteValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-232"></span><span class="hs-identifier">regDeleteValue</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-233"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-234"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-235"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegDeleteValue&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_RegDeleteValue</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_name</span><span>
</span><span id="line-236"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegDeleteValueW&quot;</span><span>
</span><span id="line-237"></span><span>  </span><span class="hs-identifier">c_RegDeleteValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-238"></span><span>
</span><span id="line-239"></span><span class="hs-comment">-- XXX Not 100% sure this is right, but I think it is.</span><span>
</span><span id="line-240"></span><span class="hs-comment">-- Surely this function already exists somewhere?</span><span>
</span><span id="line-241"></span><span class="hs-identifier">mallocWideChars</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span class="hs-special">)</span><span>
</span><span id="line-242"></span><span class="hs-identifier">mallocWideChars</span><span> </span><span class="hs-identifier">i</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">mallocBytes</span><span> </span><span class="hs-special">(</span><span class="hs-number">4</span><span> </span><span class="hs-operator">*</span><span> </span><span class="hs-identifier">i</span><span class="hs-special">)</span><span>
</span><span id="line-243"></span><span>
</span><span id="line-244"></span><span class="hs-identifier">regEnumKeys</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">[</span><span class="hs-identifier">String</span><span class="hs-special">]</span><span>
</span><span id="line-245"></span><span class="hs-identifier">regEnumKeys</span><span> </span><span class="hs-identifier">hkey</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-246"></span><span>   </span><span class="hs-identifier">hinfo</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">regQueryInfoKey</span><span> </span><span class="hs-identifier">hkey</span><span>
</span><span id="line-247"></span><span>   </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">buflen</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">1</span><span class="hs-operator">+</span><span class="hs-identifier">max_subkey_len</span><span> </span><span class="hs-identifier">hinfo</span><span>
</span><span id="line-248"></span><span>   </span><span class="hs-identifier">buf</span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">mallocWideChars</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">buflen</span><span class="hs-special">)</span><span>
</span><span id="line-249"></span><span>   </span><span class="hs-identifier">ls</span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">go</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">buflen</span><span>
</span><span id="line-250"></span><span>   </span><span class="hs-identifier">free</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-251"></span><span>   </span><span class="hs-identifier">return</span><span> </span><span class="hs-identifier">ls</span><span>
</span><span id="line-252"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-253"></span><span>   </span><span class="hs-identifier">go</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">buflen</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-254"></span><span>      </span><span class="hs-special">(</span><span class="hs-identifier">v</span><span class="hs-special">,</span><span class="hs-identifier">flg</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">regEnumKey</span><span> </span><span class="hs-identifier">hkey</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">buflen</span><span>
</span><span id="line-255"></span><span>      </span><span class="hs-keyword">if</span><span> </span><span class="hs-identifier">flg</span><span> </span><span class="hs-operator">/=</span><span> </span><span class="hs-number">0</span><span>
</span><span id="line-256"></span><span>       </span><span class="hs-keyword">then</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-257"></span><span>       </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-258"></span><span>         </span><span class="hs-identifier">vs</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">go</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">n</span><span class="hs-operator">+</span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">buflen</span><span>
</span><span id="line-259"></span><span>         </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">v</span><span class="hs-glyph">:</span><span class="hs-identifier">vs</span><span class="hs-special">)</span><span>
</span><span id="line-260"></span><span>
</span><span id="line-261"></span><span class="hs-identifier">regEnumKeyVals</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-identifier">String</span><span class="hs-special">,</span><span class="hs-identifier">String</span><span class="hs-special">,</span><span class="hs-identifier">RegValueType</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-262"></span><span class="hs-identifier">regEnumKeyVals</span><span> </span><span class="hs-identifier">hkey</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-263"></span><span>   </span><span class="hs-identifier">hinfo</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">regQueryInfoKey</span><span> </span><span class="hs-identifier">hkey</span><span>
</span><span id="line-264"></span><span>   </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">nmlen</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">1</span><span class="hs-operator">+</span><span class="hs-identifier">max_value_name_len</span><span> </span><span class="hs-identifier">hinfo</span><span>  </span><span class="hs-comment">-- add spc for terminating NUL.</span><span>
</span><span id="line-265"></span><span>   </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">vallen</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">1</span><span class="hs-operator">+</span><span class="hs-identifier">max_value_len</span><span> </span><span class="hs-identifier">hinfo</span><span>
</span><span id="line-266"></span><span>   </span><span class="hs-identifier">nmbuf</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">mallocWideChars</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">nmlen</span><span class="hs-special">)</span><span>
</span><span id="line-267"></span><span>   </span><span class="hs-identifier">valbuf</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">mallocWideChars</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">vallen</span><span class="hs-special">)</span><span>
</span><span id="line-268"></span><span>   </span><span class="hs-identifier">ls</span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">go</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">nmbuf</span><span> </span><span class="hs-identifier">nmlen</span><span> </span><span class="hs-identifier">valbuf</span><span> </span><span class="hs-identifier">vallen</span><span>
</span><span id="line-269"></span><span>   </span><span class="hs-identifier">free</span><span> </span><span class="hs-identifier">nmbuf</span><span>
</span><span id="line-270"></span><span>   </span><span class="hs-identifier">free</span><span> </span><span class="hs-identifier">valbuf</span><span>
</span><span id="line-271"></span><span>   </span><span class="hs-identifier">return</span><span> </span><span class="hs-identifier">ls</span><span>
</span><span id="line-272"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-273"></span><span>   </span><span class="hs-identifier">go</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">nmbuf</span><span> </span><span class="hs-identifier">nmlen</span><span> </span><span class="hs-identifier">valbuf</span><span> </span><span class="hs-identifier">vallen</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-274"></span><span>      </span><span class="hs-special">(</span><span class="hs-identifier">ty</span><span class="hs-special">,</span><span class="hs-identifier">nm</span><span class="hs-special">,</span><span class="hs-identifier">flg</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">regEnumValue</span><span> </span><span class="hs-identifier">hkey</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">nmbuf</span><span> </span><span class="hs-identifier">nmlen</span><span> </span><span class="hs-identifier">valbuf</span><span> </span><span class="hs-identifier">vallen</span><span>
</span><span id="line-275"></span><span>      </span><span class="hs-keyword">if</span><span> </span><span class="hs-identifier">flg</span><span> </span><span class="hs-operator">/=</span><span> </span><span class="hs-number">0</span><span>
</span><span id="line-276"></span><span>       </span><span class="hs-keyword">then</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-277"></span><span>       </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span>        </span><span class="hs-identifier">val</span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-280"></span><span>           </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-281"></span><span>             </span><span class="hs-identifier">x</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">rEG_SZ</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekTString</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">castPtr</span><span> </span><span class="hs-identifier">valbuf</span><span class="hs-special">)</span><span>
</span><span id="line-282"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">rEG_DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekElemOff</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">castPtr</span><span> </span><span class="hs-identifier">valbuf</span><span class="hs-special">)</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-operator">&gt;&gt;=</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">v</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">show</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">v</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-283"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">otherwise</span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-string">&quot;&lt;&lt;unknown&gt;&gt;&quot;</span><span>
</span><span id="line-284"></span><span>
</span><span id="line-285"></span><span>        </span><span class="hs-identifier">vs</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">go</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">n</span><span class="hs-operator">+</span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">nmbuf</span><span> </span><span class="hs-identifier">nmlen</span><span> </span><span class="hs-identifier">valbuf</span><span> </span><span class="hs-identifier">vallen</span><span>
</span><span id="line-286"></span><span>        </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier">nm</span><span class="hs-special">,</span><span class="hs-identifier">val</span><span class="hs-special">,</span><span class="hs-identifier">ty</span><span class="hs-special">)</span><span class="hs-glyph">:</span><span class="hs-identifier">vs</span><span class="hs-special">)</span><span>
</span><span id="line-287"></span><span>
</span><span id="line-288"></span><span class="hs-comment">-- It's up to the programmer to ensure that a large enough</span><span>
</span><span id="line-289"></span><span class="hs-comment">-- buffer is passed in here.</span><span>
</span><span id="line-290"></span><span>
</span><span id="line-291"></span><span class="hs-identifier">regEnumKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">String</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">Int</span><span class="hs-special">)</span><span>
</span><span id="line-292"></span><span class="hs-identifier">regEnumKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">index</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-identifier">len</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-293"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-294"></span><span>  </span><span class="hs-identifier">no_more</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">failUnlessSuccessOr</span><span> </span><span class="hs-identifier">eRROR_NO_MORE_ITEMS</span><span> </span><span class="hs-string">&quot;RegEnumKey&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-295"></span><span>    </span><span class="hs-identifier">c_RegEnumKey</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">index</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-identifier">len</span><span>
</span><span id="line-296"></span><span>  </span><span class="hs-identifier">str</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peekTString</span><span> </span><span class="hs-identifier">c_name</span><span>
</span><span id="line-297"></span><span>  </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">str</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fromEnum</span><span> </span><span class="hs-identifier">no_more</span><span class="hs-special">)</span><span>
</span><span id="line-298"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegEnumKeyW&quot;</span><span>
</span><span id="line-299"></span><span>  </span><span class="hs-identifier">c_RegEnumKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-300"></span><span>
</span><span id="line-301"></span><span class="hs-identifier">regEnumValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPBYTE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">RegValueType</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">String</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">Int</span><span class="hs-special">)</span><span>
</span><span id="line-302"></span><span class="hs-identifier">regEnumValue</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">index</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-identifier">name_len</span><span> </span><span class="hs-identifier">value</span><span> </span><span class="hs-identifier">value_len</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-303"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-304"></span><span>  </span><span class="hs-identifier">with</span><span> </span><span class="hs-identifier">name_len</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_name_len</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-305"></span><span>  </span><span class="hs-identifier">with</span><span> </span><span class="hs-identifier">value_len</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_value_len</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-306"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_reg_ty</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-307"></span><span>  </span><span class="hs-identifier">no_more</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">failUnlessSuccessOr</span><span> </span><span class="hs-identifier">eRROR_NO_MORE_ITEMS</span><span> </span><span class="hs-string">&quot;RegEnumValue&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-308"></span><span>    </span><span class="hs-identifier">c_RegEnumValue</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">index</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-identifier">p_name_len</span><span> </span><span class="hs-identifier">nullPtr</span><span> </span><span class="hs-identifier">p_reg_ty</span><span> </span><span class="hs-identifier">value</span><span> </span><span class="hs-identifier">p_value_len</span><span>
</span><span id="line-309"></span><span>  </span><span class="hs-identifier">reg_ty</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_reg_ty</span><span>
</span><span id="line-310"></span><span>  </span><span class="hs-identifier">str</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peekTString</span><span> </span><span class="hs-identifier">name</span><span>
</span><span id="line-311"></span><span>  </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">reg_ty</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">str</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fromEnum</span><span> </span><span class="hs-identifier">no_more</span><span class="hs-special">)</span><span>
</span><span id="line-312"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegEnumValueW&quot;</span><span>
</span><span id="line-313"></span><span>  </span><span class="hs-identifier">c_RegEnumValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPBYTE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-314"></span><span>
</span><span id="line-315"></span><span class="hs-identifier">eRROR_NO_MORE_ITEMS</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-316"></span><span class="hs-identifier">eRROR_NO_MORE_ITEMS</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">259</span><span>
</span><span id="line-317"></span><span class="hs-pragma">{-# LINE 317 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-317"></span><span>
</span><span id="line-318"></span><span class="hs-identifier">regFlushKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-319"></span><span class="hs-identifier">regFlushKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-320"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-321"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegFlushKey&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_RegFlushKey</span><span> </span><span class="hs-identifier">p_key</span><span>
</span><span id="line-322"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegFlushKey&quot;</span><span>
</span><span id="line-323"></span><span>  </span><span class="hs-identifier">c_RegFlushKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-324"></span><span>
</span><span id="line-325"></span><span class="hs-comment">-- ifdef FOR_WINDOWS_NT</span><span>
</span><span id="line-326"></span><span class="hs-comment">-- RegGetKeySecurity :: HKEY -&gt; SECURITY_INFORMATION -&gt; IO SECURITY_DESCRIPTION</span><span>
</span><span id="line-327"></span><span>
</span><span id="line-328"></span><span class="hs-comment">-- endif</span><span>
</span><span id="line-329"></span><span>
</span><span id="line-330"></span><span class="hs-identifier">regLoadKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-331"></span><span class="hs-identifier">regLoadKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-identifier">file</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-332"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-333"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-334"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">file</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_file</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-335"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegLoadKey&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_RegLoadKey</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">c_file</span><span>
</span><span id="line-336"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegLoadKeyW&quot;</span><span>
</span><span id="line-337"></span><span>  </span><span class="hs-identifier">c_RegLoadKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-338"></span><span>
</span><span id="line-339"></span><span class="hs-comment">-- ifdef FOR_WINDOWS_NT</span><span>
</span><span id="line-340"></span><span>
</span><span id="line-341"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">RegNotifyOptions</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-342"></span><span>
</span><span id="line-343"></span><span class="hs-identifier">rEG_NOTIFY_CHANGE_NAME</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegNotifyOptions</span><span>
</span><span id="line-344"></span><span class="hs-identifier">rEG_NOTIFY_CHANGE_NAME</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-345"></span><span class="hs-identifier">rEG_NOTIFY_CHANGE_ATTRIBUTES</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegNotifyOptions</span><span>
</span><span id="line-346"></span><span class="hs-identifier">rEG_NOTIFY_CHANGE_ATTRIBUTES</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-347"></span><span class="hs-identifier">rEG_NOTIFY_CHANGE_LAST_SET</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegNotifyOptions</span><span>
</span><span id="line-348"></span><span class="hs-identifier">rEG_NOTIFY_CHANGE_LAST_SET</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-349"></span><span class="hs-identifier">rEG_NOTIFY_CHANGE_SECURITY</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegNotifyOptions</span><span>
</span><span id="line-350"></span><span class="hs-identifier">rEG_NOTIFY_CHANGE_SECURITY</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-351"></span><span>
</span><span id="line-352"></span><span class="hs-pragma">{-# LINE 349 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-349"></span><span>
</span><span id="line-350"></span><span class="hs-identifier">regNotifyChangeKeyValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">RegNotifyOptions</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-351"></span><span class="hs-identifier">regNotifyChangeKeyValue</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">watch</span><span> </span><span class="hs-identifier">notifyFilter</span><span> </span><span class="hs-identifier">event</span><span> </span><span class="hs-identifier">async</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-352"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-353"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegNotifyChangeKeyValue&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-354"></span><span>    </span><span class="hs-identifier">c_RegNotifyChangeKeyValue</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">watch</span><span> </span><span class="hs-identifier">notifyFilter</span><span> </span><span class="hs-identifier">event</span><span> </span><span class="hs-identifier">async</span><span>
</span><span id="line-355"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegNotifyChangeKeyValue&quot;</span><span>
</span><span id="line-356"></span><span>  </span><span class="hs-identifier">c_RegNotifyChangeKeyValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">RegNotifyOptions</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-357"></span><span>
</span><span id="line-358"></span><span class="hs-comment">-- endif</span><span>
</span><span id="line-359"></span><span>
</span><span id="line-360"></span><span class="hs-comment">-- for Win 3.x compatibility, use RegOpenKeyEx instead.</span><span>
</span><span id="line-361"></span><span>
</span><span id="line-362"></span><span class="hs-identifier">regOpenKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HKEY</span><span>
</span><span id="line-363"></span><span class="hs-identifier">regOpenKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-364"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-365"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-366"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_res</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-367"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegOpenKey&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_RegOpenKey</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">p_res</span><span>
</span><span id="line-368"></span><span>  </span><span class="hs-identifier">p_res_key</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_res</span><span>
</span><span id="line-369"></span><span>  </span><span class="hs-identifier">newForeignHANDLE</span><span> </span><span class="hs-identifier">p_res_key</span><span>
</span><span id="line-370"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegOpenKeyW&quot;</span><span>
</span><span id="line-371"></span><span>  </span><span class="hs-identifier">c_RegOpenKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-372"></span><span>
</span><span id="line-373"></span><span class="hs-identifier">regOpenKeyEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">REGSAM</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HKEY</span><span>
</span><span id="line-374"></span><span class="hs-identifier">regOpenKeyEx</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-identifier">sam</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-375"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-376"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-377"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_res</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-378"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegOpenKeyEx&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_RegOpenKeyEx</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">sam</span><span> </span><span class="hs-identifier">p_res</span><span>
</span><span id="line-379"></span><span>  </span><span class="hs-identifier">p_res_key</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_res</span><span>
</span><span id="line-380"></span><span>  </span><span class="hs-identifier">newForeignHANDLE</span><span> </span><span class="hs-identifier">p_res_key</span><span>
</span><span id="line-381"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegOpenKeyExW&quot;</span><span>
</span><span id="line-382"></span><span>  </span><span class="hs-identifier">c_RegOpenKeyEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">REGSAM</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-383"></span><span>
</span><span id="line-384"></span><span class="hs-keyword">data</span><span> </span><span class="hs-identifier">RegInfoKey</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-385"></span><span>  </span><span class="hs-identifier">RegInfoKey</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-386"></span><span>    </span><span class="hs-identifier">class_string</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span class="hs-special">,</span><span>
</span><span id="line-387"></span><span>    </span><span class="hs-identifier">class_id</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Int</span><span class="hs-special">,</span><span>
</span><span id="line-388"></span><span>    </span><span class="hs-identifier">subkeys</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Word32</span><span class="hs-special">,</span><span>
</span><span id="line-389"></span><span>    </span><span class="hs-identifier">max_subkey_len</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Word32</span><span class="hs-special">,</span><span>
</span><span id="line-390"></span><span>    </span><span class="hs-identifier">max_class_len</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Word32</span><span class="hs-special">,</span><span>
</span><span id="line-391"></span><span>    </span><span class="hs-identifier">values</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Word32</span><span class="hs-special">,</span><span>
</span><span id="line-392"></span><span>    </span><span class="hs-identifier">max_value_name_len</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Word32</span><span class="hs-special">,</span><span>
</span><span id="line-393"></span><span>    </span><span class="hs-identifier">max_value_len</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Word32</span><span class="hs-special">,</span><span>
</span><span id="line-394"></span><span>    </span><span class="hs-identifier">sec_len</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Int</span><span class="hs-special">,</span><span>
</span><span id="line-395"></span><span>    </span><span class="hs-identifier">lastWrite_lo</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Word32</span><span class="hs-special">,</span><span>
</span><span id="line-396"></span><span>    </span><span class="hs-identifier">lastWrite_hi</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Word32</span><span>
</span><span id="line-397"></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-398"></span><span>
</span><span id="line-399"></span><span class="hs-identifier">regQueryInfoKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">RegInfoKey</span><span>
</span><span id="line-400"></span><span class="hs-identifier">regQueryInfoKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-401"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-402"></span><span>  </span><span class="hs-identifier">allocaBytes</span><span> </span><span class="hs-number">100</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_class_string</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-403"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_class_id</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-404"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_subkeys</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-405"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_max_subkey_len</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-406"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_max_class_len</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-407"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_values</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-408"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_max_value_name_len</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-409"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_max_value_len</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-410"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_sec_len</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-411"></span><span>  </span><span class="hs-identifier">allocaBytes</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_lastWrite</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-412"></span><span class="hs-pragma">{-# LINE 412 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-412"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegQueryInfoKey&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-413"></span><span>    </span><span class="hs-identifier">c_RegQueryInfoKey</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_class_string</span><span> </span><span class="hs-identifier">p_class_id</span><span> </span><span class="hs-identifier">nullPtr</span><span> </span><span class="hs-identifier">p_subkeys</span><span>
</span><span id="line-414"></span><span>        </span><span class="hs-identifier">p_max_subkey_len</span><span> </span><span class="hs-identifier">p_max_class_len</span><span> </span><span class="hs-identifier">p_values</span><span> </span><span class="hs-identifier">p_max_value_name_len</span><span>
</span><span id="line-415"></span><span>        </span><span class="hs-identifier">p_max_value_len</span><span> </span><span class="hs-identifier">p_sec_len</span><span> </span><span class="hs-identifier">p_lastWrite</span><span>
</span><span id="line-416"></span><span>  </span><span class="hs-identifier">class_string'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peekTString</span><span> </span><span class="hs-identifier">c_class_string</span><span>
</span><span id="line-417"></span><span>  </span><span class="hs-identifier">class_id'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_class_id</span><span>
</span><span id="line-418"></span><span>  </span><span class="hs-identifier">subkeys'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_subkeys</span><span>
</span><span id="line-419"></span><span>  </span><span class="hs-identifier">max_subkey_len'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_max_subkey_len</span><span>
</span><span id="line-420"></span><span>  </span><span class="hs-identifier">max_class_len'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_max_class_len</span><span>
</span><span id="line-421"></span><span>  </span><span class="hs-identifier">values'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_values</span><span>
</span><span id="line-422"></span><span>  </span><span class="hs-identifier">max_value_name_len'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_max_value_name_len</span><span>
</span><span id="line-423"></span><span>  </span><span class="hs-identifier">max_value_len'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_max_value_len</span><span>
</span><span id="line-424"></span><span>  </span><span class="hs-identifier">sec_len'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_sec_len</span><span>
</span><span id="line-425"></span><span>  </span><span class="hs-identifier">lastWrite_lo'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p_lastWrite</span><span>
</span><span id="line-426"></span><span class="hs-pragma">{-# LINE 426 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-426"></span><span>  </span><span class="hs-identifier">lastWrite_hi'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">4</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p_lastWrite</span><span>
</span><span id="line-427"></span><span class="hs-pragma">{-# LINE 427 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-427"></span><span>  </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">RegInfoKey</span><span>
</span><span id="line-428"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">class_string</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">class_string'</span><span>
</span><span id="line-429"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">class_id</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">class_id'</span><span>
</span><span id="line-430"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">subkeys</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">subkeys'</span><span>
</span><span id="line-431"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">max_subkey_len</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">max_subkey_len'</span><span>
</span><span id="line-432"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">max_class_len</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">max_class_len'</span><span>
</span><span id="line-433"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">values</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">values'</span><span>
</span><span id="line-434"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">max_value_name_len</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">max_value_name_len'</span><span>
</span><span id="line-435"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">max_value_len</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">max_value_len'</span><span>
</span><span id="line-436"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sec_len</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">sec_len'</span><span>
</span><span id="line-437"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">lastWrite_lo</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">lastWrite_lo'</span><span>
</span><span id="line-438"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">lastWrite_hi</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">lastWrite_hi'</span><span>
</span><span id="line-439"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-440"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegQueryInfoKeyW&quot;</span><span>
</span><span id="line-441"></span><span>  </span><span class="hs-identifier">c_RegQueryInfoKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">FILETIME</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-442"></span><span>
</span><span id="line-443"></span><span class="hs-comment">-- RegQueryMultipleValues :: HKEY -&gt; IO ([VALENT],String)</span><span>
</span><span id="line-444"></span><span>
</span><span id="line-445"></span><span class="hs-pragma">{-# DEPRECATED</span><span> </span><span class="hs-pragma">regQueryValueKey</span><span> </span><span class="hs-pragma">&quot;Use regQueryValue instead.&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-446"></span><span class="hs-identifier">regQueryValueKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">String</span><span>
</span><span id="line-447"></span><span class="hs-identifier">regQueryValueKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">mb_subkey</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-448"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-449"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">mb_subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-450"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_value_len</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-451"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegQueryValueKey&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-452"></span><span>    </span><span class="hs-identifier">c_RegQueryValue</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">nullPtr</span><span> </span><span class="hs-identifier">p_value_len</span><span>
</span><span id="line-453"></span><span>  </span><span class="hs-identifier">value_len</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_value_len</span><span>
</span><span id="line-454"></span><span>  </span><span class="hs-identifier">allocaArray0</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">value_len</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_value</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-455"></span><span>    </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegQueryValueKey&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-456"></span><span>      </span><span class="hs-identifier">c_RegQueryValue</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">c_value</span><span> </span><span class="hs-identifier">p_value_len</span><span>
</span><span id="line-457"></span><span>    </span><span class="hs-identifier">peekTString</span><span> </span><span class="hs-identifier">c_value</span><span>
</span><span id="line-458"></span><span>
</span><span id="line-459"></span><span class="hs-identifier">regQueryValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">String</span><span>
</span><span id="line-460"></span><span class="hs-identifier">regQueryValue</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">mb_subkey</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-461"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-462"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">mb_subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-463"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_value_len</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-464"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegQueryValue&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-465"></span><span>    </span><span class="hs-identifier">c_RegQueryValue</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">nullPtr</span><span> </span><span class="hs-identifier">p_value_len</span><span>
</span><span id="line-466"></span><span>  </span><span class="hs-identifier">value_len</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_value_len</span><span>
</span><span id="line-467"></span><span>  </span><span class="hs-identifier">allocaArray0</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">value_len</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_value</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-468"></span><span>    </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegQueryValue&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-469"></span><span>      </span><span class="hs-identifier">c_RegQueryValue</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">c_value</span><span> </span><span class="hs-identifier">p_value_len</span><span>
</span><span id="line-470"></span><span>    </span><span class="hs-identifier">peekTString</span><span> </span><span class="hs-identifier">c_value</span><span>
</span><span id="line-471"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegQueryValueW&quot;</span><span>
</span><span id="line-472"></span><span>  </span><span class="hs-identifier">c_RegQueryValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">LONG</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-473"></span><span>
</span><span id="line-474"></span><span class="hs-comment">-- Gets the data associated with the default value of a key (assumed to be of</span><span>
</span><span id="line-475"></span><span class="hs-comment">-- type REG_SZ) using RegQeryValueEx.</span><span>
</span><span id="line-476"></span><span class="hs-identifier">regQueryDefaultValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">String</span><span>
</span><span id="line-477"></span><span class="hs-identifier">regQueryDefaultValue</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">mb_subkey</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-478"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-479"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">mb_subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-480"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_ty</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-481"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_value_len</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-482"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;regQueryDefaultValue&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-483"></span><span>    </span><span class="hs-identifier">c_RegQueryValueEx</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">nullPtr</span><span> </span><span class="hs-identifier">p_ty</span><span> </span><span class="hs-identifier">nullPtr</span><span> </span><span class="hs-identifier">p_value_len</span><span>
</span><span id="line-484"></span><span>  </span><span class="hs-identifier">ty</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_ty</span><span>
</span><span id="line-485"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;regQueryDefaultValue&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">rEG_SZ</span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
</span><span id="line-486"></span><span>  </span><span class="hs-identifier">value_len</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_value_len</span><span>
</span><span id="line-487"></span><span>  </span><span class="hs-identifier">allocaArray0</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">value_len</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_value</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-488"></span><span>    </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;regQueryDefaultValue&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-489"></span><span>      </span><span class="hs-identifier">c_RegQueryValueEx</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">nullPtr</span><span> </span><span class="hs-identifier">p_ty</span><span> </span><span class="hs-identifier">c_value</span><span> </span><span class="hs-identifier">p_value_len</span><span>
</span><span id="line-490"></span><span>    </span><span class="hs-identifier">peekTString</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">castPtr</span><span> </span><span class="hs-identifier">c_value</span><span class="hs-special">)</span><span>
</span><span id="line-491"></span><span>
</span><span id="line-492"></span><span class="hs-identifier">regQueryValueEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPBYTE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-493"></span><span class="hs-identifier">regQueryValueEx</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-identifier">value</span><span> </span><span class="hs-identifier">value_len</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-494"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-495"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-496"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_ty</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-497"></span><span>  </span><span class="hs-identifier">with</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">value_len</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_value_len</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-498"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegQueryValueEx&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-499"></span><span>    </span><span class="hs-identifier">c_RegQueryValueEx</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-identifier">nullPtr</span><span> </span><span class="hs-identifier">p_ty</span><span> </span><span class="hs-identifier">value</span><span> </span><span class="hs-identifier">p_value_len</span><span>
</span><span id="line-500"></span><span>  </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_ty</span><span>
</span><span id="line-501"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegQueryValueExW&quot;</span><span>
</span><span id="line-502"></span><span>  </span><span class="hs-identifier">c_RegQueryValueEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPBYTE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-503"></span><span>
</span><span id="line-504"></span><span class="hs-identifier">regReplaceKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-505"></span><span class="hs-identifier">regReplaceKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-identifier">newfile</span><span> </span><span class="hs-identifier">oldfile</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-506"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-507"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-508"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">newfile</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_newfile</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-509"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">oldfile</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_oldfile</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-510"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegReplaceKey&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-511"></span><span>    </span><span class="hs-identifier">c_RegReplaceKey</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">c_newfile</span><span> </span><span class="hs-identifier">c_oldfile</span><span>
</span><span id="line-512"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegReplaceKeyW&quot;</span><span>
</span><span id="line-513"></span><span>  </span><span class="hs-identifier">c_RegReplaceKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-514"></span><span>
</span><span id="line-515"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">RegRestoreFlags</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-516"></span><span>
</span><span id="line-517"></span><span class="hs-identifier">rEG_WHOLE_HIVE_VOLATILE</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegRestoreFlags</span><span>
</span><span id="line-518"></span><span class="hs-identifier">rEG_WHOLE_HIVE_VOLATILE</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-519"></span><span class="hs-identifier">rEG_REFRESH_HIVE</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegRestoreFlags</span><span>
</span><span id="line-520"></span><span class="hs-identifier">rEG_REFRESH_HIVE</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-521"></span><span class="hs-identifier">rEG_NO_LAZY_FLUSH</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegRestoreFlags</span><span>
</span><span id="line-522"></span><span class="hs-identifier">rEG_NO_LAZY_FLUSH</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-523"></span><span>
</span><span id="line-524"></span><span class="hs-pragma">{-# LINE 522 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-522"></span><span>
</span><span id="line-523"></span><span class="hs-identifier">regRestoreKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">RegRestoreFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-524"></span><span class="hs-identifier">regRestoreKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">file</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-525"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-526"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">file</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_file</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-527"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegRestoreKey&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_RegRestoreKey</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_file</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-528"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegRestoreKeyW&quot;</span><span>
</span><span id="line-529"></span><span>  </span><span class="hs-identifier">c_RegRestoreKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">RegRestoreFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-530"></span><span>
</span><span id="line-531"></span><span class="hs-identifier">regSaveKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-532"></span><span class="hs-identifier">regSaveKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">file</span><span> </span><span class="hs-identifier">mb_attr</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-533"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-534"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">file</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_file</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-535"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegSaveKey&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_RegSaveKey</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_file</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_attr</span><span class="hs-special">)</span><span>
</span><span id="line-536"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegSaveKeyW&quot;</span><span>
</span><span id="line-537"></span><span>  </span><span class="hs-identifier">c_RegSaveKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-538"></span><span>
</span><span id="line-539"></span><span class="hs-comment">-- ifdef FOR_WINDOWS_NT</span><span>
</span><span id="line-540"></span><span>
</span><span id="line-541"></span><span class="hs-comment">-- RegSetKeySecurity :: HKEY -&gt; SECURITY_INFORMATION -&gt; SECURITY_DESCRIPTOR -&gt; IO ()</span><span>
</span><span id="line-542"></span><span>
</span><span id="line-543"></span><span class="hs-comment">-- endif</span><span>
</span><span id="line-544"></span><span>
</span><span id="line-545"></span><span class="hs-comment">-- 3.1 compat. - only allows storage of REG_SZ values.</span><span>
</span><span id="line-546"></span><span>
</span><span id="line-547"></span><span class="hs-identifier">regGetValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPDWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPVOID</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPDWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-548"></span><span class="hs-identifier">regGetValue</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">m_subkey</span><span> </span><span class="hs-identifier">m_valuename</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">m_type</span><span> </span><span class="hs-identifier">m_value</span><span> </span><span class="hs-identifier">m_size</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-549"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-550"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">m_subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-551"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">m_valuename</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_valuename</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-552"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegGetValue&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-553"></span><span>    </span><span class="hs-identifier">c_RegGetValue</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">c_valuename</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">m_type</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">m_value</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">m_size</span><span class="hs-special">)</span><span>
</span><span id="line-554"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegGetValueW&quot;</span><span>
</span><span id="line-555"></span><span>  </span><span class="hs-identifier">c_RegGetValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPDWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPVOID</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPDWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-556"></span><span>
</span><span id="line-557"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-558"></span><span>
</span><span id="line-559"></span><span class="hs-identifier">rRF_RT_ANY</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-560"></span><span class="hs-identifier">rRF_RT_ANY</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">65535</span><span>
</span><span id="line-561"></span><span class="hs-identifier">rRF_RT_DWORD</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-562"></span><span class="hs-identifier">rRF_RT_DWORD</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">24</span><span>
</span><span id="line-563"></span><span class="hs-identifier">rRF_RT_QWORD</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-564"></span><span class="hs-identifier">rRF_RT_QWORD</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">72</span><span>
</span><span id="line-565"></span><span class="hs-identifier">rRF_RT_REG_BINARY</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-566"></span><span class="hs-identifier">rRF_RT_REG_BINARY</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-567"></span><span class="hs-identifier">rRF_RT_REG_DWORD</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-568"></span><span class="hs-identifier">rRF_RT_REG_DWORD</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-569"></span><span class="hs-identifier">rRF_RT_REG_EXPAND_SZ</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-570"></span><span class="hs-identifier">rRF_RT_REG_EXPAND_SZ</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-571"></span><span class="hs-identifier">rRF_RT_REG_MULTI_SZ</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-572"></span><span class="hs-identifier">rRF_RT_REG_MULTI_SZ</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32</span><span>
</span><span id="line-573"></span><span class="hs-identifier">rRF_RT_REG_NONE</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-574"></span><span class="hs-identifier">rRF_RT_REG_NONE</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-575"></span><span class="hs-identifier">rRF_RT_REG_QWORD</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-576"></span><span class="hs-identifier">rRF_RT_REG_QWORD</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">64</span><span>
</span><span id="line-577"></span><span class="hs-identifier">rRF_RT_REG_SZ</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-578"></span><span class="hs-identifier">rRF_RT_REG_SZ</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-579"></span><span class="hs-identifier">rRF_NOEXPAND</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-580"></span><span class="hs-identifier">rRF_NOEXPAND</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">268435456</span><span>
</span><span id="line-581"></span><span class="hs-identifier">rRF_ZEROONFAILURE</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-582"></span><span class="hs-identifier">rRF_ZEROONFAILURE</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">536870912</span><span>
</span><span id="line-583"></span><span class="hs-identifier">rRF_SUBKEY_WOW6464KEY</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-584"></span><span class="hs-identifier">rRF_SUBKEY_WOW6464KEY</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">65536</span><span>
</span><span id="line-585"></span><span class="hs-identifier">rRF_SUBKEY_WOW6432KEY</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegTypeRestriction</span><span>
</span><span id="line-586"></span><span class="hs-identifier">rRF_SUBKEY_WOW6432KEY</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">131072</span><span>
</span><span id="line-587"></span><span>
</span><span id="line-588"></span><span class="hs-pragma">{-# LINE 575 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-575"></span><span>
</span><span id="line-576"></span><span class="hs-identifier">regSetValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-577"></span><span class="hs-identifier">regSetValue</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-identifier">value</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-578"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-579"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-580"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">value</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_value</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-581"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegSetValue&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-582"></span><span>    </span><span class="hs-identifier">c_RegSetValue</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-identifier">rEG_SZ</span><span> </span><span class="hs-identifier">c_value</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-comment">-- cbData is ignored, value needs to be null terminated.</span><span>
</span><span id="line-583"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegSetValueW&quot;</span><span>
</span><span id="line-584"></span><span>  </span><span class="hs-identifier">c_RegSetValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-585"></span><span>
</span><span id="line-586"></span><span>
</span><span id="line-587"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">RegValueType</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-588"></span><span>
</span><span id="line-589"></span><span class="hs-identifier">rEG_BINARY</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-590"></span><span class="hs-identifier">rEG_BINARY</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">3</span><span>
</span><span id="line-591"></span><span class="hs-identifier">rEG_DWORD</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-592"></span><span class="hs-identifier">rEG_DWORD</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-593"></span><span class="hs-identifier">rEG_DWORD_LITTLE_ENDIAN</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-594"></span><span class="hs-identifier">rEG_DWORD_LITTLE_ENDIAN</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-595"></span><span class="hs-identifier">rEG_DWORD_BIG_ENDIAN</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-596"></span><span class="hs-identifier">rEG_DWORD_BIG_ENDIAN</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">5</span><span>
</span><span id="line-597"></span><span class="hs-identifier">rEG_EXPAND_SZ</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-598"></span><span class="hs-identifier">rEG_EXPAND_SZ</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-599"></span><span class="hs-identifier">rEG_LINK</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-600"></span><span class="hs-identifier">rEG_LINK</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">6</span><span>
</span><span id="line-601"></span><span class="hs-identifier">rEG_MULTI_SZ</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-602"></span><span class="hs-identifier">rEG_MULTI_SZ</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">7</span><span>
</span><span id="line-603"></span><span class="hs-identifier">rEG_NONE</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-604"></span><span class="hs-identifier">rEG_NONE</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-605"></span><span class="hs-identifier">rEG_RESOURCE_LIST</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-606"></span><span class="hs-identifier">rEG_RESOURCE_LIST</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-607"></span><span class="hs-identifier">rEG_SZ</span><span>                </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RegValueType</span><span>
</span><span id="line-608"></span><span class="hs-identifier">rEG_SZ</span><span>                </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-609"></span><span>
</span><span id="line-610"></span><span class="hs-pragma">{-# LINE 601 &quot;libraries\\Win32\\System\\Win32\\Registry.hsc&quot; #-}</span><span>
</span><span id="line-601"></span><span>
</span><span id="line-602"></span><span class="hs-comment">-- regSetValueEx has a somewhat wieldly interface if all you want to do is</span><span>
</span><span id="line-603"></span><span class="hs-comment">-- add a string value (a Common Thing to want to do), so we support this</span><span>
</span><span id="line-604"></span><span class="hs-comment">-- specially:</span><span>
</span><span id="line-605"></span><span class="hs-identifier">regSetStringValue</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-606"></span><span class="hs-identifier">regSetStringValue</span><span> </span><span class="hs-identifier">hk</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">val</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-607"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">val</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">v</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-608"></span><span>  </span><span class="hs-identifier">regSetValueEx</span><span> </span><span class="hs-identifier">hk</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">rEG_SZ</span><span> </span><span class="hs-identifier">v</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-number">1</span><span class="hs-operator">+</span><span class="hs-identifier">length</span><span> </span><span class="hs-identifier">val</span><span class="hs-special">)</span><span> </span><span class="hs-operator">*</span><span> </span><span class="hs-identifier">sizeOf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">undefined</span><span class="hs-glyph">::</span><span class="hs-identifier">TCHAR</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-609"></span><span>
</span><span id="line-610"></span><span class="hs-identifier">regSetValueEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">RegValueType</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-611"></span><span class="hs-identifier">regSetValueEx</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-identifier">value</span><span> </span><span class="hs-identifier">value_len</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-612"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-613"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-614"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegSetValueEx&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-615"></span><span>    </span><span class="hs-identifier">c_RegSetValueEx</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-identifier">value</span><span> </span><span class="hs-identifier">value_len</span><span>
</span><span id="line-616"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegSetValueExW&quot;</span><span>
</span><span id="line-617"></span><span>  </span><span class="hs-identifier">c_RegSetValueEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">RegValueType</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-618"></span><span>
</span><span id="line-619"></span><span class="hs-identifier">regUnLoadKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-620"></span><span class="hs-identifier">regUnLoadKey</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-621"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">key</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-622"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">subkey</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_subkey</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-623"></span><span>  </span><span class="hs-identifier">failUnlessSuccess</span><span> </span><span class="hs-string">&quot;RegUnLoadKey&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_RegUnLoadKey</span><span> </span><span class="hs-identifier">p_key</span><span> </span><span class="hs-identifier">c_subkey</span><span>
</span><span id="line-624"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RegUnLoadKeyW&quot;</span><span>
</span><span id="line-625"></span><span>  </span><span class="hs-identifier">c_RegUnLoadKey</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">PKEY</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">ErrCode</span><span>
</span><span id="line-626"></span></pre></body></html>